﻿using Microsoft.AspNetCore.Mvc.ModelBinding;
using System.ComponentModel.DataAnnotations;

namespace Step4.Unit4.ModelBinding.Models
{
    public class Category
    {
        public int Id { get; set; }
        public String? CategoryName { get; set; }
    }

    public class ProductInput
    {
        public int Id { get; set; }

        [Display(Name ="商品名称：")]
        public String? ProductName { get; set; }

        [BindNever]  // 标识属性不绑定，(一般用不着)
        [Display(Name ="商品价格")]
        public decimal Price { get; set; }

        [BindRequired] // 默认就是"BindRequired"，表示"必须绑定"，前端没有也不给你报错
        [Display(Name ="商品种类")]
        public Category? ProductCategory { get; set; }

        public IFormFile? ProductImage { get; set; }
    }
}
